﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ORM_Benchmark.Runner.Interface;

namespace ORM_Benchmark.Runner.MassiveORM
{
    public class MassiveProducts : DynamicModel
    {
        public MassiveProducts(IConnect connect)
            : base(connectionString: connect.ConnectionString)
        {
            TableName = "Products";
            PrimaryKeyField = "Id";
        }

        internal void InsertAll(List<dynamic> massiveProducts)
        {
            massiveProducts.ForEach(product => Insert(product));
        }

        internal void UpdateAll(IEnumerable<dynamic> massiveProducts)
        {
            foreach (var massiveProduct in massiveProducts)
                Update(massiveProduct, massiveProduct.Id);
        }
    }
}
